
console.log(1);

setTimeout( () => console.log(2), 0 );

let p = new Promise((resolve, reject)=>{
    console.log(3);
    setTimeout( ()=> {
        console.log('abc');
        //resolve('delay');
        reject('delay');
    }, 0);
});
p.then( result => console.log(4) )
 .catch( reason => console.log(reason) )
 .finally( () => console.log('finally') );

console.log(5);

Promise.resolve('hello').then( value => console.log( value ) );

setTimeout( () => console.log(6), 0 );

console.log(7);